package cineplanet.modelo;

import java.io.Serializable;
import javax.persistence.*;

import java.util.Collection;

/**
 * The persistent class for the cine database table.
 * 
 */
@Entity
@Table(name = "cine")
@NamedQueries({
		@NamedQuery(name = "Cine.findAll", query = "SELECT ci FROM Cine ci"),
		@NamedQuery(name = "Cine.findByIdPelicula", query = "SELECT ci FROM Cine ci WHERE ci.idCine = :idCine"),
		@NamedQuery(name = "Cine.findByDireccion", query = "SELECT ci FROM Cine ci WHERE ci.direccion = :direccion"),
		@NamedQuery(name = "Cine.findByEstado", query = "SELECT ci FROM Cine ci WHERE ci.estado = :estado"),
		@NamedQuery(name = "Cine.findByNombre", query = "SELECT ci FROM Cine ci WHERE ci.nombre = :nombre")
		})
public class Cine implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idCine")
	private Integer idCine;
	@Column(name = "direccion")
	private String direccion;
	@Column(name = "estado")
	private byte estado;
	@Column(name = "nombre")
	private String nombre;

	// bi-directional many-to-one association to Horario
	// @OneToMany(mappedBy="cine")
	// private Set<Horario> horarios;

	@OneToMany(cascade = CascadeType.ALL, mappedBy = "idCine")
	private Collection<Horario> horarioCollection;

	// bi-directional many-to-one association to Sala
	// @OneToMany(mappedBy="cine")
	// private Set<Sala> salas;

	@OneToMany(cascade = CascadeType.ALL, mappedBy = "idCine")
	private Collection<Sala> salaCollection;

	public Cine() {
	}

	public int getIdCine() {
		return this.idCine;
	}

	public void setIdCine(int idCine) {
		this.idCine = idCine;
	}

	public String getDireccion() {
		return this.direccion;
	}

	public void setDireccion(String direccion) {
		this.direccion = direccion;
	}

	public byte getEstado() {
		return this.estado;
	}

	public void setEstado(byte estado) {
		this.estado = estado;
	}

	public String getNombre() {
		return this.nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	public void setSalaCollection(Collection<Sala> salaCollection) {
		this.salaCollection = salaCollection;
	}

	public Collection<Sala> getSalaCollection() {
		return salaCollection;
	}
	@Override
    public int hashCode() {
        int hash = 0;
        hash += (idCine != null ? idCine.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cine)) {
            return false;
        }
        Cine other = (Cine) object;
        if ((this.idCine == null && other.idCine != null) || (this.idCine != null && !this.idCine.equals(other.idCine))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cineplanet.modelo.Cine[idCine=" + idCine + "]";
    }

	public void setHorarioCollection(Collection<Horario> horarioCollection) {
		this.horarioCollection = horarioCollection;
	}

	public Collection<Horario> getHorarioCollection() {
		return horarioCollection;
	}
}